package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 素材类型枚举 素材类型,0-图片,1-视频
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum MaterialTypeEnum {

    /**
     * 0-图片
     */
    PICTURE(1, "图片"),
    /**
     * 1-视频
     */
    VIDEO(2, "视频");

    private final Integer code;
    private final String name;

    public static MaterialTypeEnum getNameByCode(Integer code) {
        return Arrays.stream(MaterialTypeEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
